package com.shop.cereshop.app.tencent.im.model.redpacket;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Entity;
import javax.persistence.Id;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * @description: 红包领取记录
 * @author zdd
 * @date 2025/9/3 14:30
 * @version 1.0
 */
@Entity
@TableName("cere_red_packet_receive_record")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class RedPacketReceiveRecord implements Serializable {

    private static final long serialVersionUID = 1L;

    /** 领取记录ID */
    @Id
    @TableId(value = "id", type = IdType.NONE)
    private String id;

    /** 红包ID（关联cere_red_packet表的packet_id） */
    private String packetId;

    /** 子红包分配编号（关联cere_red_packet_allocation表的allocation_no） */
    private String allocationNo;

    /** 领取者ID */
    private String receiverId;

    /** 领取者名称 */
    private String receiverName;

    /** 领取金额（单位：元） */
    private BigDecimal amount;

    /** 是否手气最佳：0-否 1-是（仅拼手气红包有效） */
    private Integer isLuckiest;

    /** 领取时间 */
    private LocalDateTime receiveTime;

    public RedPacketReceiveRecordVO covertToVO() {
        RedPacketReceiveRecordVO vo = new RedPacketReceiveRecordVO();
        vo.setId(this.id);
        vo.setPacketId(this.packetId);
        vo.setAllocationNo(this.allocationNo);
        vo.setReceiverId(this.receiverId);
        vo.setReceiverName(this.receiverName);
        vo.setAmount(this.amount);
        vo.setIsLuckiest(this.isLuckiest);
        vo.setReceiveTime(this.receiveTime);
        return vo;
    }

}
